<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@taglib uri="http://www.springframework.org/tags" prefix="spring"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%
	request.setAttribute("path", request.getContextPath());
%>
<script type="text/javascript">
$(function(){
	if(${display}){
		$("input").attr("disabled","disabled");
		$("select").attr("disabled","disabled");
	}else{
		validate();
	}
});
function validate(){

	$("#expressNo").change(function (){
		check.emptyCheck("expressNo");
	});

	$("#fromName").change(function (){
		check.emptyCheck("fromName");
	});

	$("#fromUser").change(function (){
		check.emptyCheck("fromUser");
	});

	$("#fromAddress").change(function (){
		check.emptyCheck("fromAddress");
	});

	$("#fromContact").change(function (){
		check.emptyCheck("fromContact");
	});

	$("#toName").change(function (){
		check.emptyCheck("toName");
	});

	$("#toUser").change(function (){
		check.emptyCheck("toUser");
	});

	$("#toAddress").change(function (){
		check.emptyCheck("toAddress");
	});

	$("#toContact").change(function (){
		check.emptyCheck("toContact");
	});

	$("#number").change(function (){
		check.emptyCheck("number") && check.intNum("number");
	});

	$("#cost").change(function (){
		!common.isEmpty($(this).val()) && check.floatNum("cost");
	});

	$("#weight").change(function (){
		!common.isEmpty($(this).val()) && check.floatNum("weight");
	});

	
}

function validateSubmit(){

	return check.emptyCheck("expressNo") & check.emptyCheck("fromName") & check.emptyCheck("fromUser") &
	check.emptyCheck("fromAddress") & check.emptyCheck("fromContact") & check.emptyCheck("toName") &
	check.emptyCheck("toUser") & check.emptyCheck("toAddress") &  check.emptyCheck("toContact") & 
	check.intNum("number") & (!common.isEmpty($("#cost").val()) && check.floatNum("cost")) &
	(!common.isEmpty($("#weight").val()) && check.floatNum("weight"));
	
}
function save(){

	if(validateSubmit()){
		var uri = "${root}/stock/post/update"
		common.ajaxSubmit(uri,"expressForm","保存快递失败","",'common.windowClose()');
	}
	
}
</script>
<form class="form-horizontal" id="expressForm" role="form">
	<jsp:include page="../base/token.jsp" />
	<input type="hidden" name="requestId" value="${stockRequestId}"/>
	<table>
		<tr>
		<th>物流:</th>
		<td>
	    	<select  name="expressType" class="input-xlarge">
	    		<c:forEach var="item" items="${expressTypes}">
	    			<option value="${item.id }"  <c:if test="${item.id == vo.expressType}">selected="selected"</c:if>><c:out value="${item.name }"/></option>
		  		</c:forEach>
		   </select>
		</td>
		<th>单号:</th>
		<td> <input type="text" class="input-xlarge" name="expressNo" id="expressNo" maxlength="100" value="${vo.expressNo}"></td>
		</tr>
		
		<tr>
		<th>发货单位:</th>
		<td>
 			<input type="text" class="input-xlarge" name="fromName" id="fromName" maxlength="100" value="${vo.fromName}"  >
		</td>
		<th>收货单位:</th>
		<td>  <input type="text" class="input-xlarge" name="toName" id="toName" maxlength="100" value="${vo.toName }" ></td>
		</tr>
		
		<tr>
		<th>发货人:</th>
		<td>
 			 <input type="text" class="input-xlarge" name="fromUser" id="fromUser" maxlength="100" value="${vo.fromUser}"  >
		</td>
		<th>收货人:</th>
		<td>  <input type="text" class="input-xlarge" name="toUser" id="toUser" maxlength="100" value="${vo.toUser }" ></td>
		</tr>
		
		<tr>
		<th>发货地址:</th>
		<td>
 			<input type="text" class="input-xlarge" name="fromAddress" id="fromAddress" maxlength="200" value="${vo.fromAddress}"  >
		</td>
		<th>收货地址:</th>
		<td> <input type="text" class="input-xlarge" name="toAddress" id="toAddress" maxlength="200" value="${vo.toAddress }" ></td>
		</tr>
		
		<tr>
		<th>发货电话:</th>
		<td>
 			<input type="text" class="input-xlarge" name="fromContact" id="fromContact" maxlength="200" value="${vo.fromContact}"  >
		</td>
		<th>收货电话:</th>
		<td>  <input type="text" class="input-xlarge" name="toContact" id="toContact" maxlength="200" value="${vo.toContact }" ></td>
		</tr>
		
		<tr>
		<th>数量:</th>
		<td>
 			<input type="text" class="input-xlarge" name="number" id="number" maxlength="200" value="${vo.number}"  >
		</td>
		<th>收货邮编:</th>
		<td> <input type="text" class="input-xlarge" name="toZip" id="toZip" maxlength="200" value="${vo.toZip }" ></td>
		</tr>
		
		<tr>
		<th>费用:</th>
		<td>
 			<input type="text" class="input-xlarge" name="cost" id="cost" maxlength="200" value="${vo.cost}"  >
		</td>
		<th>重量:</th>
		<td><input type="text" class="input-xlarge" name="weight" id="weight" maxlength="200" value="${vo.weight }" ></td>
		</tr>
		
		<tr>
		<th>体积:</th>
		<td>
 			<input type="text" class="input-xlarge" name="size" id="size" maxlength="200" value="${vo.size}"  >
		</td>
		<th>状态:</th>
		<td><span class="input-xlarge uneditable-input"><spring:message code="${vo.status}"></spring:message></span></td>
		</tr>
		<tr>
		<th>备注:</th>
		<td colspan="3">
 			<input type="text" class="input-xxlarge"   name="comments" id="comments" maxlength="500" value="${vo.comments}"  >
		</td>
		</tr>	
		
		<tr>
			<th>创建人:</th>
			<td><span class="input-xlarge uneditable-input"><c:out value="${product.createUser}"></c:out></span></td>
			<th>创建时间:</th>
			<td><span class="input-xlarge uneditable-input"><fmt:formatDate value="${product.createTime}" pattern="yyyy-MM-dd hh:mm"/></span></td>
		</tr>
		<tr>
			<th>更新人:</th>
			<td><span class="input-xlarge uneditable-input"><c:out value="${product.updateUser}"></c:out></span></td>
			<th>更新时间:</th>
			<td><span class="input-xlarge uneditable-input"><fmt:formatDate value="${product.updateTime }" pattern="yyyy-MM-dd hh:mm"/></span></td>
		</tr>
	</table>
	
	<div class="form-actions text-center">
	      <c:if test="${!display }">
	      	<button type="button" class="btn btn-primary" onclick="save()">保存</button>
	      </c:if>
	       <button type="button" class="btn btn-default" onclick="common.windowClose()">关闭</button>
	</div>
</form>
